package main

import (
	"fmt"
	"sync"
	"time"
)

var lock sync.Mutex

type person struct {
	salary int
	level  int
}

func (p *person) promote() {

	lock.Lock()
	p.salary += 1000
	fmt.Println(p.salary)
	p.level += 1
	fmt.Println(p.level)
	lock.Unlock()

}

func main() {

	p := person{
		salary: 1000,
		level:  1,
	}

	go p.promote()
	go p.promote()
	go p.promote()
	time.Sleep(time.Minute)
}
